//
//  SmsCloudMainController.m
//  smsCloud
//
//  Created by 蓝鳍互娱 on 2024/7/19.
//

#import "SmsCloudMainController.h"
#import "SmsCloudWebController.h"
#import "SmsCloudVipController.h"
#import "SmsCloudMainNavView.h"
#import "SmsCloudMainVipView.h"
#import "SmsCloudMainAgreementView.h"
@interface SmsCloudMainController ()
@property (nonatomic,strong) SmsCloudMainNavView *smsCloudMainNavView;
@property (nonatomic,strong) SmsCloudMainVipView *smsCloudMainVipView;
@property (nonatomic,strong) SmsCloudMainAgreementView *smsCloudMainAgreementView;
@end
@implementation SmsCloudMainController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = YES;
    self.view.backgroundColor = [SmsCloudHead SmsCloudColorHexString:@"#FFFFFF"];
    [self smsCloudInitView];
}
-(SmsCloudMainNavView *)smsCloudMainNavView{
    if(!_smsCloudMainNavView){
        __weak __typeof__(self) weakSelf = self;
        _smsCloudMainNavView = [[SmsCloudMainNavView alloc] init];
        _smsCloudMainNavView.smsCloudNavTitle = @"我的";
        _smsCloudMainNavView.SmsCloudMainBackBlock = ^{
            [weakSelf.navigationController popViewControllerAnimated:true];
        };
    }
    return _smsCloudMainNavView;
}
-(SmsCloudMainVipView *)smsCloudMainVipView{
    if(!_smsCloudMainVipView){
        __weak __typeof__(self) weakSelf = self;
        _smsCloudMainVipView = [[SmsCloudMainVipView alloc] init];
        _smsCloudMainVipView.SmsCloudMainOpenVipBlock = ^{
            SmsCloudVipController * smsCloudVipCtrl = [[SmsCloudVipController alloc] init];
            UINavigationController * smsCloudVipNavCtrl = [[UINavigationController alloc] initWithRootViewController:smsCloudVipCtrl];
            smsCloudVipNavCtrl.modalPresentationStyle = UIModalPresentationOverFullScreen;
            [weakSelf presentViewController:smsCloudVipNavCtrl animated:true completion:^{}];
            smsCloudVipCtrl.ApplePayScuBlock = ^{
                [weakSelf.smsCloudMainVipView smsCloudUpdataVip];
            };
        };
    }
    return _smsCloudMainVipView;
}
-(SmsCloudMainAgreementView *)smsCloudMainAgreementView{
    if(!_smsCloudMainAgreementView){
        __weak __typeof__(self) weakSelf = self;
        _smsCloudMainAgreementView = [[SmsCloudMainAgreementView alloc] init];
        _smsCloudMainAgreementView.SmsCloudMainUserBlock = ^{
            SmsCloudWebController * smsCloudWebCtrl = [[SmsCloudWebController alloc] init];
            smsCloudWebCtrl.smsCloudWebUrl = [SmsCloudHead SmsCloudPublicForUserAg];
            [weakSelf.navigationController pushViewController:smsCloudWebCtrl animated:true];
        };
        _smsCloudMainAgreementView.SmsCloudMainPriBlock = ^{
            SmsCloudWebController * smsCloudWebCtrl = [[SmsCloudWebController alloc] init];
            smsCloudWebCtrl.smsCloudWebUrl = [SmsCloudHead SmsCloudPublicForPriAg];
            [weakSelf.navigationController pushViewController:smsCloudWebCtrl animated:true];
        };
    }
    return _smsCloudMainAgreementView;
}
- (void)smsCloudInitView{
    [self.view addSubview:self.smsCloudMainNavView];
    [self.view addSubview:self.smsCloudMainVipView];
    [self.view addSubview:self.smsCloudMainAgreementView];

    [self.smsCloudMainNavView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.right.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.top.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:133] + [SmsCloudHead SmsCloudTopSafeH]));
    }];
    [self.smsCloudMainVipView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.right.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.top.equalTo(self.smsCloudMainNavView.mas_bottom);
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:220]));
    }];
    [self.smsCloudMainAgreementView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.right.equalTo(@([SmsCloudHead SmsCloudScreewRatio:0]));
        make.top.equalTo(self.smsCloudMainVipView.mas_bottom).offset([SmsCloudHead SmsCloudScreewRatio:13]);
        make.height.equalTo(@([SmsCloudHead SmsCloudScreewRatio:208]));
    }];
}
@end
